package com.daoyin.ssph.frontAction;

import java.io.UnsupportedEncodingException;

import org.apache.struts2.ServletActionContext;

import com.daoyin.ssph.bean.Application;
import com.daoyin.ssph.service.AppService;

public class AppAction {
	private AppService app;
	private String name;
	private String age;
	private String adress;
	private String phone;
	private String email;
	private String school;
	private String zy;
	private String company;
	private String hy;
	private String qwhy;
	private String money;
	private String achadr;
	private String id;
	private String tid;
	private String jineng;
	public void setApp(AppService app) {
		this.app = app;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setAge(String age) {
		this.age = age;
	}
	public void setAdress(String adress) {
		this.adress = adress;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public void setSchool(String school) {
		this.school = school;
	}
	public void setZy(String zy) {
		this.zy = zy;
	}
	public void setCompany(String company) {
		this.company = company;
	}
	public void setHy(String hy) {
		this.hy = hy;
	}
	public void setQwhy(String qwhy) {
		this.qwhy = qwhy;
	}
	public void setMoney(String money) {
		this.money = money;
	}
	public void setAchadr(String achadr) {
		this.achadr = achadr;
	}
	public void setId(String id) {
		this.id = id;
	}
	public void setTid(String tid) {
		this.tid = tid;
	}
	public void setJineng(String jineng) {
		this.jineng = jineng;
	}
	public String add() throws UnsupportedEncodingException{
		ServletActionContext.getRequest().setCharacterEncoding("utf-8");
		Application application = new Application();
		application.setAchadr(achadr);
		application.setAdress(adress);
		application.setAge(age);
		application.setCompany(company);
		application.setEmail(email);
		application.setHy(hy);
		application.setJineng(jineng);
		application.setMoney(money);
		application.setName(name);
		application.setPhone(phone);
		application.setQwhy(qwhy);
		application.setSchool(school);
		application.setZy(zy);
		String str = app.add(application);
		if(("success").equals(str)){
			return "success";
		}
		return "fail";
		
	}
}
